<template>
  <div class="pogoress-chart" ref="progressChartRef">ProgressChart</div>
</template>

<script lang="ts">
export default {
  name: 'ProgressChart',
}
</script>

<script lang="ts" setup>
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'

const progressChartRef = ref()

onMounted(() => {
  const myEchart = echarts.init(progressChartRef.value)
  const option = {
    xAxis: {
      show: false,
      min: 0,
      max: 100,
    },
    yAxis: {
      data: ['进度'],
      show: false,
    },
    series: {
      type: 'bar',
      data: [78],
      barWidth: 10, // 柱条宽度
      showBackground: true, // 显示背景色
      itemStyle: {
        // 柱条样式
        color: 'yellowgreen',
      },
      label: {
        // 显示的内容
        show: true,
        formatter: '|',
        position: 'right',
        color: 'yellowgreen',
      },
    },
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
    },
  }
  myEchart.setOption(option)
})
</script>

<style scoped>
.pogoress-chart {
  width: 100%;
  height: 100%;
}
</style>
